package com.vmj.instructions.comparisions;

import com.vmj.instructions.base.BranchInstruction;
import com.vmj.rtda.Frame;
import com.vmj.rtda.OperandStack;

/**
 * Created by yangshoujun on 2017/9/17 下午2:10.
 */
public class IfIcmpEq extends BranchInstruction {

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();
        int v2 = stack.popInt();
        int v1 = stack.popInt();
        if(v1 == v2) {
            BranchInstruction.branch(frame, getOffset());
        }
    }
}